//双向链表快速排序
void sort()
{
    FastSort(head->next,tail);
}
void FastSort(Node *start,Node *end)
{
    if(start==end)
        return;
    Node *left=start;
    Node *right=end;
    ElementType *tmp=start->value;
    while(left!=right)
    {
        while(right->value>tmp&&left!=right)
            right=right->prev;
        if(left!=right)
        {
            std::swap(left->value,right->value);
            left=left->next
        }
        while(left->value<tmp&&left!=right)
            left=left->next;
        if(left!=right)
        {
            std::swap(left->value,right->value);
           right=right->prev;
        
        }
    }
    left->value=tmp;
    if(start!=left) FastSort(start,left->prev);
    if(end!=right)  FastSort(right->next,end);
}
//双向链表的头插法
void InsertHead(const ElementType& element)
{
    Node *newNode=new Node(element);
    newNode->next=head->next;
    newNode->prev=head;
    head->next=newNode;
    if(size>0)
    newNode->next->prev=newNode;
}